from time import *
import pyOsi

#Create a problem pointer.  We use the base class here.
theSI = pyOsi.getOsi("CBC")


#Read in an mps file.  This one's from the MIPLIB library.
#si->readMps("../../Data/Sample/p0033");
theSI.readMps("p0033")
#theSI.branchAndBound()

#Solve the (relaxation of the) problem
print "***INITIAL SOLVE***"
mytime = -time()
theSI.initialSolve()

mytime += time()

print "***BOUND & RESOLVE***"
mytime2 = -time()
theSI.setColUpper(1 , 0.5 )
theSI.resolve()
mytime2 += time()

print "***RHS & RESOLVE***"
mytime3 = -time()
theSI.setRowUpper(1 , 1.5 )
theSI.resolve()
mytime3 += time()

print "***OBJ & RESOLVE***"
mytime4 = -time()
theSI.setObjCoeff(1 , 0)
theSI.resolve()
mytime4 += time()


print "Initial solve in %f seconds " % mytime
print "resolve after bound change in %f seconds " % mytime2
print "resolve after RHS change in %f seconds " % mytime3
print "resolve after objective change in %f seconds " % mytime4
